class Solution
{
public:
    int countSymmetricIntegers(int low, int high)
    {
        int count = 0;
        for (int i = low; i <= high; ++i)
        {
            string s = to_string(i);
            if (s.size() & 1)
            {
                continue;
            }
            int frontVal = 0;
            int backVal = 0;
            for (int j = 0; j < s.size() / 2; ++j)
            {
                frontVal += s[j];
                backVal += s[s.size() - 1 - j];
            }
            if (frontVal == backVal)
            {
                ++count;
            }
        }
        return count;
    }
};